package com.digua.base.view

import android.content.Context
import android.util.AttributeSet
import android.view.MotionEvent
import androidx.viewpager.widget.ViewPager

class NoScrollViewPager : ViewPager {
    var noScroll = true

    constructor(context: Context) : super(context)

    constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)

    override fun onTouchEvent(arg0: MotionEvent?) =
        if (noScroll) false else super.onTouchEvent(arg0)

    override fun onInterceptTouchEvent(arg0: MotionEvent?) =
        if (noScroll) false else super.onInterceptTouchEvent(arg0)

}